function catmond() {
    $('.catmond2>span').mouseover(function() {
        $(this).addClass('spans').siblings().removeClass('spans')
    })
    $('.flsh-left>ul>li').mouseover(function() {
        $(this).addClass('flsha').siblings().removeClass('flsha')
    })

    let index = 0
    $('.ban_cont>div').mouseover(function() {

        index++
        if (index > 1) {
            index = 0
        }
        $(this).addClass('banban').siblings().removeClass('banban')
        $('.banContent>img').addClass('imgsa').eq(index).siblings().removeClass('imgsa')


    })
    $('.city').on('mouseover', function() {
        $('.ICityList').show();
        $('.city').addClass('current');
        $('.city_l p').addClass('up')
        $('.ICityList').removeClass('none')

    })

    $('.city').on('mouseout', function() {
        $('.ICityList').hide()
        $('.city').removeClass('current');
        $('.city_l p').removeClass('up')
        $('.ICityList').addClass('none')
    })
    $('.city_select a').on('click', function() {
        $('.city_select a').removeClass("current")
        $(this).addClass('current')
        console.log($(this).text())
        $(".city_l strong").text($(this).text())
    })
}
catmond()

function catmond1() {
    var catmond2 = $('.catmond2 span')
    var catbox2 = $('.catbox2')
    var xhr = new XMLHttpRequest()
    var out = {}
    xhr.open('get', 'http://localhost:3000/cat/user?tom=1', true)
    xhr.send()
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            var data = JSON.parse(xhr.responseText)
                // console.log(data);

            if (data.code) {
                // console.log(data.data);

                out['1'] = data.data

                console.log(out['1']);

                var html = ''
                    // console.log(out['1']);
                out['1'].forEach(function(item, index) {
                    html += `<ul class='catboxd'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            }
        }
    }
    catmond2.each((index, item) => {
        catmond2.on("mouseover", function() {
            var node = this.getAttribute('node')
            if (out[node]) {
                var html = ''
                out[node].forEach((item, index) => {
                    html += `<ul class='catboxd'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            } else {
                xhr.open('get', `http://localhost:3000/cat/user?tom=${node}`, true)
                xhr.send()
                xhr.onreadystatechange = function() {
                    if (xhr.readyState == 4 && xhr.status == 200) {
                        var data = JSON.parse(xhr.responseText)
                        if (data.code) {
                            out[node] = data.data
                            var html = ''
                            out[node].forEach((item, index) => {

                                html += `<ul class='catboxd'>
                                <img src='${item.img}'>
                                <p>${item.title}</p>
                                <span>${'¥'+item.price}</span>
                                <a>${'已售'+item.sale}</a>
                                </ul>`
                            })
                            catbox2.html(html)
                        }
                    }
                }
            }

        })
    })
}
catmond1()

function catmond2() {
    var catmond2 = $('.flash>ul>li')
    var catbox2 = $('.flshonda')
    var xhr = new XMLHttpRequest()
    var out = {}
    xhr.open('get', 'http://localhost:3000/cat/goodsa?tom=1', true)
    xhr.send()
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            var data = JSON.parse(xhr.responseText)
                // console.log(data);

            if (data.code) {
                // console.log(data.data);

                out['1'] = data.data

                console.log(out['1']);

                var html = ''
                    // console.log(out['1']);
                out['1'].forEach(function(item, index) {
                    html += `<ul class='catboxde'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            }
        }
    }
    catmond2.each((index, item) => {
        catmond2.on("mouseover", function() {
            var node = this.getAttribute('node')
            if (out[node]) {
                var html = ''
                out[node].forEach((item, index) => {
                    html += `<ul class='catboxde'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            } else {
                xhr.open('get', `http://localhost:3000/cat/goodsa?tom=${node}`, true)
                xhr.send()
                xhr.onreadystatechange = function() {
                    if (xhr.readyState == 4 && xhr.status == 200) {
                        var data = JSON.parse(xhr.responseText)
                        if (data.code) {
                            out[node] = data.data
                            var html = ''
                            out[node].forEach((item, index) => {

                                html += `<ul class='catboxde'>
                                <img src='${item.img}'>
                                <p>${item.title}</p>
                                <span>${item.price}</span>
                                <a>${item.sale}</a>
                                </ul>`
                            })
                            catbox2.html(html)
                        }
                    }
                }
            }

        })
    })
}
catmond2()

function catmond3() {
    var catmond2 = $('.flbsh>ul>li')
    var catbox2 = $('.flshondb')
    var xhr = new XMLHttpRequest()
    var out = {}
    xhr.open('get', 'http://localhost:3000/cat/goodsb?tom=2', true)
    xhr.send()
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            var data = JSON.parse(xhr.responseText)
                // console.log(data);

            if (data.code) {
                // console.log(data.data);

                out['1'] = data.data

                console.log(out['1']);

                var html = ''
                    // console.log(out['1']);
                out['1'].forEach(function(item, index) {
                    html += `<ul class='catboxde'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            }
        }
    }
    catmond2.each((index, item) => {
        catmond2.on("mouseover", function() {
            var node = this.getAttribute('node')
            if (out[node]) {
                var html = ''
                out[node].forEach((item, index) => {
                    html += `<ul class='catboxde'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            } else {
                xhr.open('get', `http://localhost:3000/cat/goodsb?tom=${node}`, true)
                xhr.send()
                xhr.onreadystatechange = function() {
                    if (xhr.readyState == 4 && xhr.status == 200) {
                        var data = JSON.parse(xhr.responseText)
                        if (data.code) {
                            out[node] = data.data
                            var html = ''
                            out[node].forEach((item, index) => {

                                html += `<ul class='catboxde'>
                                <img src='${item.img}'>
                                <p>${item.title}</p>
                                <span>${item.price}</span>
                                <a>${item.sale}</a>
                                </ul>`
                            })
                            catbox2.html(html)
                        }
                    }
                }
            }

        })
    })
}
catmond3()

function catmond4() {
    var catmond2 = $('.flcsh>ul>li')
    var catbox2 = $('.flshondc')
    var xhr = new XMLHttpRequest()
    var out = {}
    xhr.open('get', 'http://localhost:3000/cat/goodsc?tom=5', true)
    xhr.send()
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            var data = JSON.parse(xhr.responseText)
                // console.log(data);

            if (data.code) {
                // console.log(data.data);

                out['1'] = data.data

                console.log(out['1']);

                var html = ''
                    // console.log(out['1']);
                out['1'].forEach(function(item, index) {
                    html += `<ul class='catboxde'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            }
        }
    }
    catmond2.each((index, item) => {
        catmond2.on("mouseover", function() {
            var node = this.getAttribute('node')
            if (out[node]) {
                var html = ''
                out[node].forEach((item, index) => {
                    html += `<ul class='catboxde'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            } else {
                xhr.open('get', `http://localhost:3000/cat/goodsc?tom=${node}`, true)
                xhr.send()
                xhr.onreadystatechange = function() {
                    if (xhr.readyState == 4 && xhr.status == 200) {
                        var data = JSON.parse(xhr.responseText)
                        if (data.code) {
                            out[node] = data.data
                            var html = ''
                            out[node].forEach((item, index) => {

                                html += `<ul class='catboxde'>
                                <img src='${item.img}'>
                                <p>${item.title}</p>
                                <span>${item.price}</span>
                                <a>${item.sale}</a>
                                </ul>`
                            })
                            catbox2.html(html)
                        }
                    }
                }
            }

        })
    })
}
catmond4()

function catmond5() {
    var catmond2 = $('.fldsh>ul>li')
    var catbox2 = $('.flshondd')
    var xhr = new XMLHttpRequest()
    var out = {}
    xhr.open('get', 'http://localhost:3000/cat/goodsd?tom=6', true)
    xhr.send()
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            var data = JSON.parse(xhr.responseText)
                // console.log(data);

            if (data.code) {
                // console.log(data.data);

                out['1'] = data.data

                console.log(out['1']);

                var html = ''
                    // console.log(out['1']);
                out['1'].forEach(function(item, index) {
                    html += `<ul class='catboxde'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            }
        }
    }
    catmond2.each((index, item) => {
        catmond2.on("mouseover", function() {
            var node = this.getAttribute('node')
            if (out[node]) {
                var html = ''
                out[node].forEach((item, index) => {
                    html += `<ul class='catboxde'>
                    <img src='${item.img}'>
                    <p>${item.title}</p>
                    <span>${'¥'+item.price}</span>
                    <a>${'已售'+item.sale}</a>
                    </ul>`
                })
                catbox2.html(html)
            } else {
                xhr.open('get', `http://localhost:3000/cat/goodsd?tom=${node}`, true)
                xhr.send()
                xhr.onreadystatechange = function() {
                    if (xhr.readyState == 4 && xhr.status == 200) {
                        var data = JSON.parse(xhr.responseText)
                        if (data.code) {
                            out[node] = data.data
                            var html = ''
                            out[node].forEach((item, index) => {

                                html += `<ul class='catboxde'>
                                <img src='${item.img}'>
                                <p>${item.title}</p>
                                <span>${item.price}</span>
                                <a>${item.sale}</a>
                                </ul>`
                            })
                            catbox2.html(html)
                        }
                    }
                }
            }

        })
    })
}
catmond5()